nwnfandomcom-20200213-history
Make a projectile trap origin with base attack bonus
category:Script_directory:Traps_and_Puzzles Make a projectile trap origin with Base Attack Bonus Have you ever placed an invisible projectile trap (to look like darts are firing out of walls) only to be disappointed when it only hits the PC when it rolls a 20 because the PC already has an AC of more than 20 and placeables cannot have any BAB? Well here is a relatively simple, if not slightly involved way of solving this problem. Lets suppose that we want a trap with a BAB of 10. To start with, download a creature hakpak from the vault which:- * does not appear in the CEP * you know you are not going to use in your module Personally I like this one by Magma Click Here because I'm pretty sure its not in the CEP atm although that could change of course, but any creature will do for this as long as the above two rules are followed. Now create a new mod or use the mod that comes with the erinyes hakpak, create a new creature with the creature wizard, remove any initial levels of creature ability i.e. Outsider level 1 and replace with 10 levels of fighter because we want a BAB of 10. Leave the appearance and portrait for the moment and click next. Set the new creature to commoner. Call your new creature "Level 10 Trap 1", we will need a seperate creature for each trap location you wish to send projectiles from. The tag will now be "Level10Trap1" and the ResRef will be "level10trap1". Now assign it under special or anywhere else you wish to keep these blueprints in the mod you are going to transfer this to. Now click next again and check the the box for "Launch Creature Properties". First, set the appearance to the erinyes or whatever creature you are going to use that will not appear in your module you are creating. Now set the name of the creature to something like "Dart Trap", or something suitable for your module so that the player gets the message in game of "Dart Trap attempts ranged touch attack". Now click on the portrait button, (you don't have to do this part but it serves as a visual reminder what this does) now click on the radio button for Placeable Objects and doors and after 19 clicks downwards you will see a ballista, I set the portrait to that. Now click on the stats tab and set all stats to 10 and the movement rate to Immobile, everything else on this page can be left as it is. Now click on the advanced tab and make sure you set the creature to commoner and remove any sound set, we don't want out trap grunting, not that I think it would anyway!! You can make the creature "plot" if you like, but it doesn't matter because the player will not be able to interact with it. Now click the Ok button and your trap is created. Right click on the newly created blueprint and select "export", click save and then uncheck the box that says reset to parent faction. Ok, your done for this part. Now open the mod you want your new trap to appear in. First of all, click on File in the top left hand corner and drop down to import, click on that and now select the "level10trap1" from your .erf directory, the game uses the ResRef to identify the .erf, now import the trap creature. Open up the custom creatures tree and find the new trap. If you open up your trap creature and click "Ok" to close it you will get a warning message of "ModelType for appearance not found in 2da. This should not happen!" Just click ok to close, but you shouldn't need to do this if you did everything right in the 1st part, but you can still adjust things if necessary this way. Now remember that this creature does not have an appearance so you cannot paint it into your module. We will have to create the trap creature and this is why you will need a seperate creature for each trap placeable each with a different ResRef and therefore Tag which you will using to fire the missile. So, now paint in a waypoint where you would like the creature to be positioned, something like "cr8_position_lvl10_trap_1" or whatever you want. Now paint in a trigger in the path of the PC before he gets to the room with your trap in it and use something along the following to create your trap creature. /* Script generated by Lilac Soul's NWN Script Generator, v. 1.6 For download info, please visit: http://www.lilacsoul.revility.com */ //Put this OnEnter void main() { object oPC = GetEnteringObject(); if (!GetIsPC(oPC)) return; object oTarget; object oSpawn; location lTarget; oTarget = GetWaypointByTag("cr8_position_lvl10_trap_1"); lTarget = GetLocation(oTarget); oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "level10trap1", lTarget); } make sure the trigger is placed at least 5 seconds real time away from the trigger for the trap, this allows enough time for the trap creature to be created. DON'T place them too close together in other words. Now place a trap trigger where you want it in the room where the trap will fire. Open up the properties and click on the "Trap" tab. Now click on the "Edit" button on the On Trap Triggered event and place the following script in there:- #include "x0_i0_projtrap" void main() { object oPC = GetEnteringObject(); if (!GetIsPC(oPC)) return; object oLevel10Trap1 = GetObjectByTag("Level10Trap1"); AssignCommand(oLevel10Trap1, ClearAllActions()); TriggerProjectileTrap(SPELL_TRAP_DART, GetEnteringObject(), 15, oLevel10Trap1, OBJECT_SELF, PROJECTILE_PATH_TYPE_HOMING); } Note the 15 in the above script, this is what sets the trap power, 15 is for a strong trap. Try messing with this number until you get the damage that you want. Note you can change SPELL_TRAP_DART to SPELL_TRAP_ARROW or SPELL_TRAP_SHURIKEN or SPELL_TRAP_BOLT if you want to. If you want the trap to fire at monsters as well as yourself then remove the "if (!GetIsPC(oPC)) return;" Now set the trigger with the suitable settings for your module, i.e. one shot, disarmable etc. If you want the player to be able to see the trap origin, like a ballista for example, then paint in a ballista and put the trap creature behind or to the side of the ballista so it appears that the ballista is firing, you may have to play around with the waypoint to get this right. Anyway, that should do it and you should now have a trap with Base Attack Bonus.